package com.example.demo.test3.controller;

import com.example.demo.utils.ComputeSignatureUtil;
import com.google.gson.Gson;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jws;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.gson.io.GsonDeserializer;
import io.jsonwebtoken.security.Keys;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.codec.digest.DigestUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.crypto.SecretKey;
import java.nio.charset.StandardCharsets;
import java.util.UUID;

/**
 * @ClassName SignatureController
 * @Author lys4134
 * @Date 2021/06/16 14:35:20
 * @Description SignatureController
 * @Version 1.0
 **/
@RestController
@RequestMapping("/signature/")
public class SignatureController {
    @GetMapping("getSignature")
    @ApiOperation("获取Signature")
    public String getSignature(String appcode,String nonce,Long timestamp,String body,String appsecret) throws Exception {
        String signature = ComputeSignatureUtil.computeSignature(appcode, nonce, timestamp, "", appsecret);
        return signature;
    }
}
